Skip to content

refactor: enhance recovery-related tests with API mocks#221

Merged
danielpeng1 merged 1 commit into
masterfrom
WAL-1489/recovery-tests-refactoring
Jun 4, 2026
Merged

refactor: enhance recovery-related tests with API mocks#221
danielpeng1 merged 1 commit into
masterfrom
WAL-1489/recovery-tests-refactoring

Conversation

@danielpeng1
Copy link
Copy Markdown
Contributor

Fourth (and final /master tests) pass. This is for de- mocking the recovery tests to use real SDK functions.

Updated musigRecovery.test.ts, nonRecovery.test.ts, recoveryWallet.test.ts, recoveryConsolidationsWallet.test.ts, recoveryWalletMpcV2.test.ts

  • Dropped middleware/coin stubs with same approach as earlier de- mocked tests. Unlike wallet ops like sendMany, recovery endpoints take keys in the request body and don’t fetch wallets from BitGo, so the real expressApp(config) app setup works as-is without that stubbing now. We nock external chain APIs (Blockchair, Etherscan, TronGrid, Solana/SUI RPC) instead of stubbing coin.recover / recoverConsolidations.
  • Changed beforeEach -> before since app setup no longer depends on sinon stubs, so we create the app once and reset nocks/stubs in afterEach.
  • TRX/SOL/SUI keys and addresses in recoveryConsolidationsWallet.test.ts come verbatim from the SDK’s test fixtures so derivation and tx building match what the real SDK expects. AWM signing is still nocked.
  • Still stubbing Trx.prototype.recoverConsolidations in the “unexpected result structure” test as it's the only way to hit that error path since the real SDK always returns { transactions } or { txRequests }.
  • AWM nocks use body matchers where the SDK builds more complex dynamic payloads.

Ticket: WAL-1489

@danielpeng1 danielpeng1 self-assigned this Jun 4, 2026
@danielpeng1 danielpeng1 marked this pull request as ready for review June 4, 2026 15:44
@danielpeng1 danielpeng1 requested a review from a team as a code owner June 4, 2026 15:44
@danielpeng1 danielpeng1 merged commit 64a241c into master Jun 4, 2026
21 checks passed
@danielpeng1 danielpeng1 deleted the WAL-1489/recovery-tests-refactoring branch June 4, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants